package com.heima.article.controller.v1;

import com.heima.article.service.ApArticleService;
import com.heima.model.article.dtos.ApArticleDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article")
public class ApArticleController {
    @Autowired
    ApArticleService apArticleService;

    @PostMapping("/save")
    public ResponseResult saveApArticle(@RequestBody ApArticleDto apArticleDto) {
        return apArticleService.saveApArticle(apArticleDto);
    }
    @GetMapping("/one/{id}")
    public ApArticle findArticleById(@PathVariable("id") Long articleId) {
        return apArticleService.getById(articleId);
    }
    @PutMapping("/updateArticleById")
    public void updateArticleById(@RequestBody ApArticle apArticle){
        apArticleService.updateById(apArticle); //存staticUrl
    }
}
